<head>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    <script>
        $(function() {
            $('form').enableContentChangedConfirm();
        });        
        function jumpAction(submitAction) {
        	if ($("#exitpageurl").val()!=""){
        		if (IsURL($("#exitpageurl").val())==false){
        			alert("Exit Page Url is invalid!");
        			return false;
        		}
        	}
            var thisURL = document.URL;
            var tmpUPage = thisURL.split("/");
            var thisUPage = tmpUPage[tmpUPage.length - 1];
            var thisUPage = thisUPage.substr(0, thisUPage.indexOf(".html"));
            if (thisUPage == "edit") {
                editAction(submitAction)
            } else {
                var maxInclude = $("div.question").html().toLowerCase().split("<table").length;
                var fromSequence = 1;
                var questionSet = "";
                while (fromSequence < maxInclude) {
                    var thisItem = $("[sequence=" + fromSequence + "]");
                    questionSet += $(thisItem).attr("id") + ";";
                    fromSequence++;
                }
                $("#includePage").val(questionSet);
                afterSubmitRedirect("dialog", thisUPage + ".html", submitAction, "submitAction");
            }

        }
    </script>
</head>
<!-- Menu -->
<jsp:include page="menu.jsp"/>

<!--START: Subnav -->
<div class="sub_nav">
    <ul>
        <li>
            <a href="#" onclick="navToGeneral();"><img
                    src="<%=request.getContextPath()%>/images/menu/sub_general_on.gif"
                    width="114" height="18" alt="general"/> </a>
        </li>

        <li>
            <a href="#" onclick="navToPage();"><img
                    src="<%=request.getContextPath()%>/images/menu/sub_pages_off.gif"
                    width="114" height="18" alt="pages"/> </a>
        </li>
    </ul>
</div>
<!--END: Subnav -->

<!--START: content -->
<div class="content2" id="general">
<div class="insider">
<div class="corners">
<div class="corners_top"></div>
<form:form id="dialog" modelAttribute="dialog" method="post">
<input type="hidden" id="submitAction" name="submitAction"/>
<input type="hidden" id="questionnaireId" name="questionnaireId" value="${dialog.questionnaireId}"/>
<input type="hidden" id="includePage" name="includePage"/>

<div class="column1">
<div class="col_l">
<table width="440" border="0" cellspacing="4"
       class="formlayout_table">
<tr>
    <th width="188">
        <label>
            ID:
        </label>
    </th>
    <td width="240">
        ${dialog.refId}
    </td>
</tr>
<tr>
    <th>
        <label>
            Version:
        </label>
    </th>
    <td>
        ${dialog.version}
    </td>
</tr>
<tr>
    <th>
        <label>
            Name:
        </label>
    </th>
    <td class="bg_n">
        <input name="name" id="name" type="text" class="input3" value="${dialog.name}" maxlength="255"/>
    </td>
</tr>
<tr>
    <th>
        <label>
            Vocabulary Name:
        </label>
    </th>
    <td class="bg_n">
        <input name="vocabularyname" id="vocabularyname" type="text" class="input3" value="${dialog.vocabularyname}" maxlength="255"/>
    </td>
</tr>
<tr>
    <th>
        <label>
            Display Title:
        </label>
    </th>
    <td class="bg_n">
        <input name="displayTitle" id="displayTitle"
               type="text" class="input3" value="${dialog.displayTitle}" maxlength="255"/>
    </td>
</tr>
<tr>
    <th>
        <label>
            Description:
        </label>
    </th>
    <td class="bg_n">
        <textarea name="description" class="textarea2" onkeypress="if(this.value.length >=255) return false;"
                  onpaste="if(this.value.length >=255) return false;">${dialog.description}</textarea>
    </td>
</tr>
<tr>
    <th>
        <label>
            Function:
        </label>
    </th>
    <td class="bg_n">
        <select name="function.code" class="select1">
            <option value="" ${function.code eq "" ? "selected" : ""}>
                Please Select
            </option>
            <c:forEach var="function" items="${functions}">
                <option value="${function.code}"
                    ${function.code eq dialog.function.code ? "selected" : ""}>
                        ${function.code}
                </option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <th>
        <label>
            Region:
        </label>
    </th>
    <td class="bg_n">
        <select name="region.code" id="Region" class="select1">
            <option value="" ${region.code eq "" ? "selected" : ""}>
                Please Select
            </option>
            <c:forEach var="region" items="${regions}">
                <option value="${region.code}"
                    ${region.code eq dialog.region.code ? "selected" : ""}>
                        ${region.code}
                </option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <th>
        <label>
            Product Line:
        </label>
    </th>
    <td class="bg_n">
        <select name="productType.code" class="select1">
            <option value="" ${productType.code eq "" ? "selected" : ""}>
                Please Select
            </option>
            <c:forEach var="productType" items="${productTypes}">
                <option value="${productType.code}"
                    ${productType.code eq dialog.productType.code ? "selected" : ""}>
                        ${productType.code}
                </option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <th>
        <label>
            Locale:
        </label>
    </th>
    <td class="bg_n">
        <select name="locale.code" class="select1">
            <option value="" ${locale.code eq "" ? "selected" : ""}>
                Please Select
            </option>
            <c:forEach var="locale" items="${locales}">
                <option value="${locale.code}"
                    ${locale.code eq dialog.locale.code ? "selected" : ""}>
                        ${locale.code}
                </option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <th>
        <label>
            Theme:
        </label>
    </th>
    <td class="bg_n">
        <select name="theme.code" class="select1">
            <option value="" ${empty dialog.theme.code ? "selected" : ""}>
                Please Select
            </option>
            <c:forEach var="theme" items="${themes}">
                <option value="${theme.code}"
                    ${theme.code eq dialog.theme.code ? "selected" : ""}>
                        ${theme.code}
                </option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <th>
        <label>
            Enable Save:
        </label>
    </th>
    <td class="bg_n">
        <form:checkbox id="enableSave" path="enableSave" value="${dialog.enableSave}" />
    </td>
</tr>
<tr>
    <th>
        <label>
            Summary Report:
        </label>
    </th>
    <td class="bg_n">
        <select name="summaryReport" class="select1">
            <option value="">
                Please Select
            </option>
            <option value="true" <c:if test="${dialog.summaryReport==true}">selected</c:if>>
                Yes
            </option>
            <option value="false" <c:if test="${dialog.summaryReport==false}">selected</c:if>>
                No
            </option>
        </select>
    </td>
</tr>
<tr>
    <th>
        <label>
            Decision Service Name:
        </label>
    </th>
    <td class="bg_n">
        <div class="pr">
        <select name="decisionServiceName" class="select_pa">
            <option value="">
                Please Select
            </option>
            <c:forEach var="serviceName" items="${serviceNames}">
                <option value="${serviceName}"
                    ${serviceName eq dialog.decisionServiceName ? "selected" : ""}>
                        ${serviceName}
                </option>
            </c:forEach>
        </select>
    </div>
    </td>
</tr>
<tr>
    <th>
        <label>
            Decision Service Version:
        </label>
    </th>
    <td class="bg_n">
        <input name="decisionServiceVersion" type="text" class="input3" value="${dialog.decisionServiceVersion}"
               maxlength="255"/>
    </td>
</tr>
<tr>
    <th>
        <label>
            Exit Page Url:
        </label>
    </th>
    <td class="bg_n">
        <input name="exitpageurl" id = "exitpageurl" type="text" class="input3" value="${dialog.exitpageurl}"/>
    </td>
</tr>
</table>
</div>
<table width="283" border="0" cellspacing="4"
       class="formlayout_table fr">
    <tr>
        <th width="159">
            <label>
                Sibling ID:
            </label>
        </th>
        <td width="111">
            ${dialog.sibling.refId}
        </td>
    </tr>
    <tr>
        <th>
            <label>
                Sibling Version:
            </label>
        </th>
        <td>${dialog.sibling.version}
        </td>
    </tr>
    <tr>
        <th>
            <label>
                Publication Status:
            </label>
        </th>
        <td>
            ${dialog.publicationStatus.name}
        </td>
    </tr>

    <tr>
        <th width="159">
            <label>
                Last Modified Date:
            </label>
        </th>
        <td width="111">
            <c:if test="${isCreate=='IS_EDIT'}"><fmt:formatDate value="${dialog.modifiedOn}"
                                                                pattern="dd-MMM-yyyy"/></c:if>
        </td>
    </tr>
    <tr>
        <th>
            <label>
                Last Modified By:
            </label>
        </th>
        <td>
            <c:if test="${isCreate=='IS_EDIT'}">${dialog.modifiedBy.username}</c:if>
        </td>
    </tr>

    <tr>
        <th>
            <label>
                Published Date:
            </label>
        </th>
        <td></td>
    </tr>
    <tr>
        <th>
            <label>
                Published By:
            </label>
        </th>
        <td></td>
    </tr>
    <tr>
        <th>
            <label>
                Effective Date:
            </label>
        </th>
        <td></td>
    </tr>
    <tr>
        <th>
            <label>
                End Date:
            </label>
        </th>
        <td></td>
    </tr>
    <tr>
        <th>
            <label>
                Publish Notes:
            </label>
        </th>
        <td></td>
    </tr>

    <tr>
        <th>
            <label>
                Retired By:
            </label>
        </th>
        <td>
            &nbsp;
        </td>
    </tr>
    <tr>
        <th>
            <label>
                Retire Date:
            </label>
        </th>
        <td>
            &nbsp;
        </td>
    </tr>
    <tr>
        <th>
            <label>
                Retire Notes:
            </label>
        </th>
        <td>
            &nbsp;
        </td>
    </tr>
</table>
</div>
<ul class="functions1">
    <li>
        <a href="#" onclick="jumpAction('SUBMIT');"><img
                src="<%=request.getContextPath()%>/images/btn/functions1/btn_save.gif"
                width="122" height="23" class="btn"/> </a>
    </li>
    <li>
        <a href="#" onclick="jumpAction('SUBMIT_AND_EXIT');"><img
                src="<%=request.getContextPath()%>/images/btn/functions1/btn_save_exit.gif"
                width="122" height="23" class="btn"/> </a>
    </li>
    <li>
        <a href="#" onclick="jumpAction('SUBMIT_AND_NEW');"><img
                src="<%=request.getContextPath()%>/images/btn/functions1/btn_save_create_new.gif"
                alt="" width="122" height="41" class="btn"/> </a>
    </li>
    <li>
        <a href="list.html?from=cancel&checkSearch=list"><img
                src="<%=request.getContextPath()%>/images/btn/functions1/btn_cancel.gif"
                alt="" width="122" height="23" class="btn"/> </a>
    </li>
</ul>
<div class="corners_bottom"></div>
</form:form>
</div>
<div class="message">
    ${error}
    ${empty error ? "" : "<br />"}
    ${message}
    ${empty message ? "" : "<br />"}
    <font color="red">
        ${errors['name.errors'][0]}
        ${empty errors['name.errors'] ? '' : '<br />'}
        
        ${errors['vocabularyname.errors'][0]}
        ${empty errors['vocabularyname.errors'] ? '' : '<br />'}

        ${errors['text.errors'][0]}
        ${empty errors['text.errors'] ? '' : '<br />'}

        ${errors['displayTitle.errors'][0]}
        ${empty errors['displayTitle.errors'] ? '' : '<br />'}

        ${errors["function.errors"]["0"]}
        ${empty errors["function.errors"]["0"] ? "" : "<br />"}

        ${errors["region.errors"]["0"]}
        ${empty errors["region.errors"]["0"] ? "" : "<br />"}

        ${errors["productType.errors"]["0"]}
        ${empty errors["productType.errors"]["0"] ? "" : "<br />"}

        ${errors["locale.errors"]["0"]}
        ${empty errors["locale.errors"]["0"] ? "" : "<br />"}

        ${errors["theme.errors"]["0"]}
        ${empty errors["theme.errors"]["0"] ? "" : "<br />"}

        ${errors["decisionServiceName.errors"]["0"]}
        ${empty errors["decisionServiceName.errors"]["0"] ? "" : "<br />"}

        ${errors['summaryReport.errors'][0]}
        ${empty errors['SummaryReport.errors'] ? '' : '<br />'}
    </font>
</div>
</div>
</div>
<!--END: content -->
<!-- Questions Tab Page -->
<jsp:include page="pageEdit.jsp"/>
<!--START: Footer -->
<div class="footer"></div>
<!--END: Footer -->